package com.xm.export.excel.converter;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.text.StringSubstitutor;

@Getter
@AllArgsConstructor
public class TextConverter implements Converter {
    private String expression;


    @Override
    public ConverterType getType() {
        return ConverterType.text;
    }

    @Override
    public String convert(JSONObject target) {
        return new StringSubstitutor(target).replace(expression);
    }
}